import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:series_play/comm/base/base_state.dart';
import 'package:series_play/comm/ext/context_ext.dart';
import 'package:series_play/generated/assets.dart';
import 'package:series_play/pages/mine/wallet/wallet_recharge_page.dart';
import 'package:series_play/pages/mine/wallet/wallet_recharge_record_page.dart';
import 'package:series_play/pages/mine/wallet/wallet_reward_record_page.dart';
import 'package:series_play/pages/mine/wallet/wallet_unlock_record_page.dart';
import 'package:series_play/pages/mine/widget/mine_cell.dart';
import 'package:series_play/widget/app_button.dart';
import 'package:series_play/widget/app_color.dart';
import 'package:series_play/widget/app_image.dart';
import 'package:series_play/widget/app_text.dart';

import 'controller/wallet_controller.dart';

class WalletPage extends StatefulWidget {
  const WalletPage({super.key});

  @override
  State<WalletPage> createState() => _WalletPageState();
}

class _WalletPageState extends BaseControllerState<WalletPage , WalletController> {


  @override
  Widget buildPage(BuildContext context) {
    return SingleChildScrollView(
      padding: const EdgeInsets.all(16).w,
      child: Column(
        children: [
          // 金币 奖励币
          Padding(
            padding: const EdgeInsets.symmetric(horizontal: 60).w,
            child: Row(
              children: [
                Expanded(
                  child: Column(
                    children: [
                      AppText.title('12121', color: Colors.white, fontSize: 20),
                      10.verticalSpace,
                      AppText.secondary('金币', color: AppColor.white_40),
                    ],
                  ),
                ),
                Container(color: AppColor.white_10, width: 0.5.w, height: 42.w),
                Expanded(
                  child: Column(
                    children: [
                      AppText.title('12121', color: Colors.white, fontSize: 20),
                      10.verticalSpace,
                      AppText.secondary('奖励币', color: AppColor.white_40),
                    ],
                  ),
                ),
              ],
            ),
          ),
          50.verticalSpace,
          // 充值
          AppButton(
            '充值',
            onTap: () {
              Get.to(() => WalletRechargePage());
            },
          ),
          65.verticalSpace,
          Container(
            decoration: BoxDecoration(
              color: const Color(0xff292B34).withValues(alpha: 0.5),
              borderRadius: BorderRadius.circular(10).r,
            ),
            child: Column(
              children: [
                MineCell(title: '充值记录', onTap: () {
                  Get.to(() => WalletRechargeRecordPage());
                }),
                MineCell(title: '剧集解锁记录', onTap: () {
                  Get.to(() => WalletUnlockRecordPage());
                }),
                MineCell(title: '奖励金币解锁记录', onTap: () {
                  Get.to(() => WalletRewardRecordPage());
                }),
                Container(
                  padding: const EdgeInsets.only(left: 16).w,
                  height: 44.w,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      AppText('自动解锁下一集', color: Colors.white),
                      const Spacer(),
                      Transform.scale(
                        scale: 0.6,
                        child: Obx(() => Switch(
                          value: mController.isAutoUnlockNext.value,
                          onChanged: (value) {
                            mController.isAutoUnlockNext.value = value;
                          },
                        )),
                      ),
                    ],
                  ),
                ),
              ],
            ),
          ),
          // 功能区
        ],
      ),
    );
  }

  @override
  createController() {
    return WalletController();
  }

  @override
  bool showDefaultBackground() {
    return true;
  }

  @override
  String getTitle() {
    return context.tr.wallet;
  }
}
